import { storageLocal } from "@pureadmin/utils";
import type { CanvasData } from "@/stores/modules/canvas/helper";

const LOCAL_NAME = "selectGraphStorage";

export interface SelectGraphState {
  selectCanvas: CanvasData | null;
  lockselectCanvas: CanvasData | null;
}

export function defaultSetting(): SelectGraphState {
  return {
    selectCanvas: null,
    lockselectCanvas: null,
  };
}

export function getLocalState(): SelectGraphState {
  // const localSetting: SelectGraphState | undefined =
  //   storageLocal().getItem<SelectGraphState>(LOCAL_NAME);
  return { selectCanvas: null, lockselectCanvas: null };
}

export function setLocalState(SelectGraphState: SelectGraphState): void {
  storageLocal().setItem(LOCAL_NAME, SelectGraphState);
}

export function removeLocalState() {
  storageLocal().removeItem(LOCAL_NAME);
}
